package com.ruoyi.service.impl;

import com.ruoyi.domain.AdvInoutstock;
import com.ruoyi.domain.AdvUpgrade;
import com.ruoyi.mapper.AdvUpgradeMapper;
import com.ruoyi.service.AdvUpgradeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataIntegrityViolationException;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class AdvUpgradeServiceImpl implements AdvUpgradeService {

    @Autowired
    private AdvUpgradeMapper advUpgradeMapper;

    @Override
    public List<AdvUpgrade> selectAdvUpgradeList(AdvUpgrade advUpgrade) {

        return advUpgradeMapper.selectAdvUpgradeList(advUpgrade);
    }

    @Override
    public int insertAdvUpgrade(AdvUpgrade advUpgrade) {
        return advUpgradeMapper.insertAdvUpgrade(advUpgrade);
    }

    @Override
    public int updateAdvUpgrade(AdvUpgrade advUpgrade) {
        return advUpgradeMapper.updateAdvUpgrade(advUpgrade);
    }

    @Override
    public int deleteAdvUpgradeByAdvUpgradeId(Long[] advUpgradeIds) {
        try {
            return advUpgradeMapper.deleteAdvUpgradeByAdvUpgradeId(advUpgradeIds);
        }catch (DataIntegrityViolationException e){
            throw new RuntimeException("请先删除设备重启设定中关联数据");
        }

    }


}
